package com.qidian.mes.md.service.impl;

import com.qidian.mes.md.mapper.ContactMapper;
import com.qidian.mes.md.service.ContactService;
import com.qidian.mes.pojo.Contact;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 小可怎么都睡不够
 * @Description:
 * @Time: 2024-04-12 00:23
 **/
@Service
public class ContactServiceImpl implements ContactService {

    @Autowired
    private ContactMapper contactMapper;

    @Override
    public QdResult addContact(Contact contact) {
        contactMapper.addContact(contact);
        return QdResult.success("add success");
    }

    @Override
    public QdResult updateContact(Contact contact) {
        contactMapper.updateContact(contact);
        return QdResult.success("update success");
    }

    @Override
    public QdResult getContacts(String name, Integer idSupport) {
        return QdResult.success(contactMapper.getContacts(idSupport,name));
    }

    @Override
    public QdResult deleteContact(Integer[] idContact,Integer idSupport) {
        contactMapper.deleteContact(idContact,idSupport);
        return QdResult.success("delete success");
    }


    //客户联系人
    @Override
    public QdResult addCustContact(Contact contact) {
        contactMapper.addCustContact(contact);
        return QdResult.success("add success");
    }

    @Override
    public QdResult updateCustContact(Contact contact) {
        contactMapper.updateCustContact(contact);
        return QdResult.success("update success");
    }

    @Override
    public QdResult getCustContacts(String name, Integer idCustomer) {
        return QdResult.success(contactMapper.getCustContacts(idCustomer,name));
    }

    @Override
    public QdResult deleteCustContact(Integer[] id, Integer idSupport) {
        contactMapper.deleteCustContact(id,idSupport);
        return QdResult.success("delete success");
    }
}
